<?php $images = array('<img src="/images/x.gif" alt="nereseno" title="nereseno" />', '<img src="/images/q.gif" alt="procitano" title="procitano" />', '<img src="/images/v.gif" alt="reseno" title="reseno" /><img src="/images/q.gif" alt="procitano" title="neobavesten" />', '<img src="/images/v.gif" alt="reseno" title="reseno obavešten" />'); ?>

<div style="margin-top: 20px;">
   <table class="form_holder" style="margin: 10px 0pt 0pt 10px;">
      <tr>
         <th>ID</th>
         <th>Naslov</th>
         <th>Tip korisnika</th>
         <th>Korisnik</th>
         <th>Username</th>
         <th>Tip poruke</th>
         <th>Status</th>
         <th>Poslato</th>
         <th>Rešeno</th>
      </tr>

      <?php
      $p_tips = ProfilPeer::getTips();
      $g_tips = GreskaPeer::getTips();
      $g_status = GreskaPeer::getStatuss();
      foreach($greskas as $greska)
      {
         $profil = $greska->getProfil();
      ?>
      <tr>
         <td><?php echo $greska->getId() ?></td>
         <td><a id="<?php echo $greska->getId() ?>" href="javascript: void(0)" onclick="dropTable(this.id, 'greska')"><?php echo $greska->getNaslov() ?></a></td>
         <td><?php echo $p_tips[$profil->getTip()] ?></td>
         <td><?php echo $profil->getPrezime().' '.$profil->getIme() ?></td>
         <td><?php echo $profil->getUsername() ?></td>
         <td><?php echo $g_tips[$greska->getTip()] ?></td>
         <td><?php echo $images[$greska->getStatus()] ?></td>
         <td><?php echo Functions::datumSr($greska->getCreatedAt(), 1) ?></td>
         <td><?php if($odgovor = $greska->getOdgovorAt()) echo  Functions::datumSr($odgovor, 1) ?></td>
      </tr>
      <tr id="tr_<?php echo $greska->getId() ?>" class="hide"><td id="greska_<?php echo $greska->getId() ?>" colspan="9"></td></tr>
      <?php }?>
   </table>
</div>

<div class="pagination" style="margin-left: 10px; margin-top: 5px;">
  <?php
  $strana = 0;
  while($strana++ <= $broj)
  {
    echo link_to($strana, 'greska/pregled?strana='.$strana, array('style' => 'padding: 3px;'));
  }
  ?>
</div>